package com.ruoyi.web.controller.yijing;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yijing.domain.YjGuaFamous;
import com.ruoyi.yijing.service.IYjGuaiFamousService;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 名人说卦Controller
 * 
 * @author ruoyi
 * @date 2024-01-22
 */
@RestController
@RequestMapping("/yijing/guai/famous")
public class YjGuaiFamousController extends BaseController
{
    @Autowired
    private IYjGuaiFamousService yjGuaiFamousService;

    /**
     * 查询名人说卦列表
     */
    //@PreAuthorize("@ss.hasPermi('yijing:famous:list')")
    @GetMapping("/list")
    public TableDataInfo list(YjGuaFamous yjGuaiFamous)
    {
        startPage();
        List<YjGuaFamous> list = yjGuaiFamousService.selectYjGuaiFamousList(yjGuaiFamous);
        return getDataTable(list);
    }

    /**
     * 获取名人说卦详细信息
     */
    //@PreAuthorize("@ss.hasPermi('yijing:famous:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(yjGuaiFamousService.selectYjGuaiFamousById(id));
    }

    /**
     * 新增名人说卦
     */
    //@PreAuthorize("@ss.hasPermi('yijing:famous:add')")
    @Log(title = "名人说卦", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YjGuaFamous yjGuaiFamous)
    {
        return toAjax(yjGuaiFamousService.insertYjGuaiFamous(yjGuaiFamous));
    }

    /**
     * 修改名人说卦
     */
    //@PreAuthorize("@ss.hasPermi('yijing:famous:edit')")
    @Log(title = "名人说卦", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YjGuaFamous yjGuaiFamous)
    {
        return toAjax(yjGuaiFamousService.updateYjGuaiFamous(yjGuaiFamous));
    }

    /**
     * 删除名人说卦
     */
    //@PreAuthorize("@ss.hasPermi('yijing:famous:remove')")
    @Log(title = "名人说卦", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(yjGuaiFamousService.deleteYjGuaiFamousById(id));
    }
}
